import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:new_yuqib_app/yqbConfig/color_theme.dart';
import 'package:new_yuqib_app/yqbConfig/yqb_app.dart';
import 'package:new_yuqib_app/yqbConfig/yqb_base.dart';
import 'package:new_yuqib_app/yqbView/yqbfirsr_page.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  setAppStyle();
  await YqbApp.init();
  await GetStorage.init();
  runApp(const MyApp());
}

void setAppStyle() {
  const SystemUiOverlayStyle style = SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,
    statusBarIconBrightness: Brightness.light,
    systemNavigationBarIconBrightness: Brightness.light,
    systemNavigationBarColor: Colors.white,
    systemNavigationBarDividerColor: Colors.transparent,
  );
  SystemChrome.setSystemUIOverlayStyle(style);
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: appName,
      theme: ThemeData(
        inputDecorationTheme: const InputDecorationTheme(
          isDense: true,
          contentPadding: EdgeInsets.zero,
        ),
        brightness: Brightness.light,
        splashFactory: NoSplash.splashFactory,
        highlightColor: Colors.transparent,
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blueAccent),
        useMaterial3: true,
        scaffoldBackgroundColor: ColorTheme.pageBackgroundColor,
      ),
      builder: EasyLoading.init(),
      home: const YqbFirstPage(),
    );
  }
}
